<template>
    <van-row>
      <van-col :span="24">
 
         <van-row style="margin-top: 5px;background-color: beige;" v-for="detail in detailList" :key="detail.detailId">
             <van-col :span="24">
                 <div>餐品名称：{{detail.food.foodName}}</div>
                 <div>餐品数量：{{detail.quantity}}</div>
             </van-col>
         </van-row>
 
      </van-col>
    </van-row>
 </template>
 
 <script setup>
 import { ref,getCurrentInstance, onMounted } from 'vue';
 import { showNotify } from 'vant';
 
 const {proxy} = getCurrentInstance();
 
 //订单编号
 const orderId = ref(null);
 
 //订单详情列表
 const detailList = ref([]);
 
 const getDetailByOrderId = ()=>{
     proxy.$axios({
         method: 'get',
         url: '/order/detail/'+orderId.value
     }).then(res=>{
         let resultBean = res.data;
         if(resultBean.code == 200){
             detailList.value = resultBean.data;
             console.log('订单详情列表-----',detailList.value);
         }else{
             showNotify({message: resultBean.msg});
         }
     }).catch(error=>{
         showNotify({message: error.message});
     })
 }
 
 onMounted(()=>{
     orderId.value = proxy.$route.params.orderId;
     getDetailByOrderId();
 })
 
 </script>
 
 <style>
 </style>